package h8model;

// Generated 11-giu-2009 17.22.31 by Hibernate Tools 3.2.0.CR1

import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.SEQUENCE;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * Messages generated by hbm2java
 */
@Entity
@Table(name = "MESSAGES", schema = "EJB3")
public class Messages implements java.io.Serializable {

	private BigDecimal id;
	private Messages messages;
	private String messageText;
	private Set<Messages> messageses = new HashSet<Messages>(0);

	public Messages() {
	}

	public Messages(Messages messages, String messageText,
			Set<Messages> messageses) {
		this.messages = messages;
		this.messageText = messageText;
		this.messageses = messageses;
	}

	@SequenceGenerator(name = "generator", sequenceName = "MESSAGE_SEQ")
	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "generator")
	@Column(name = "ID", unique = true, nullable = false, scale = 0)
	public BigDecimal getId() {
		return this.id;
	}

	public void setId(BigDecimal id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "NEXT_MESSAGE_ID")
	public Messages getMessages() {
		return this.messages;
	}

	public void setMessages(Messages messages) {
		this.messages = messages;
	}

	@Column(name = "MESSAGE_TEXT", length = 1020)
	public String getMessageText() {
		return this.messageText;
	}

	public void setMessageText(String messageText) {
		this.messageText = messageText;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "messages")
	public Set<Messages> getMessageses() {
		return this.messageses;
	}

	public void setMessageses(Set<Messages> messageses) {
		this.messageses = messageses;
	}

}
